/**
 * Project Name:jettyTest
 * File Name:DataTableClumnInfo.java
 * Package Name:com.createproject
 * Date:2016年4月8日下午4:41:58
 * Copyright (c) 2016, ulewo.com All Rights Reserved.
 */

package com.ulewo.easyjava.bean;

/**
 * ClassName: ColumnInfo
 * date: 2016年4月11日 下午3:17:44
 * @author luohaili
 * @since JDK 1.7
 */
public class ColumnInfo implements Comparable<ColumnInfo> {
    /**
     * 字段名称
     */
    private String columnName;

    /**
     * bean属性名称
     */
    private String propertyName;

    /**
     * 字段类型
     */
    private String type;

    /**
     * 字段备注
     */
    private String comment;

    /**
     * 字段是否是自增长
     */
    private Boolean isAutoIncrement;

    /**
     * 是否是唯一主键
     */
    private Boolean isUniqueKey;

    /**
     * uniqueKey的name
     */
    private String uniqueKeyName;

    public String getColumnName() {
        return columnName;
    }

    public void setColumnName(String columnName) {
        this.columnName = columnName;
    }

    public String getPropertyName() {
        return propertyName;
    }

    public void setPropertyName(String propertyName) {
        this.propertyName = propertyName;
    }

    public String getType() {
        return type;
    }

    public void setType(String type) {
        this.type = type;
    }

    public String getComment() {
        return comment;
    }

    public void setComment(String comment) {
        this.comment = comment;
    }

    public Boolean getAutoIncrement() {
        return isAutoIncrement;
    }

    public void setAutoIncrement(Boolean autoIncrement) {
        isAutoIncrement = autoIncrement;
    }

    public Boolean getUniqueKey() {
        return isUniqueKey;
    }

    public void setUniqueKey(Boolean uniqueKey) {
        isUniqueKey = uniqueKey;
    }

    public String getUniqueKeyName() {
        return uniqueKeyName;
    }

    public void setUniqueKeyName(String uniqueKeyName) {
        this.uniqueKeyName = uniqueKeyName;
    }

    @Override
    public int compareTo(ColumnInfo o) {
        if (this.isAutoIncrement != null && this.isAutoIncrement && (o.getAutoIncrement() == null || !o.getAutoIncrement())) {
            return -1;
        } else {
            return 1;
        }
    }

}
